# -*- coding: utf-8 -*-

from django.db import models

from basic_info.models import Stock, Institute

# 券商每日发布信息模型定义

class DailyCounsel(models.Model):
    """
    当日投资顾问观点
    """
    # 发布日期
    date = models.DateField(db_index=True)
    # 发布券商
    institute = models.CharField(max_length=20)
    # 作者
    author = models.CharField(max_length=20)
    # 内容
    content = models.TextField()
    
    def __unicode__(self):
        return self.date, self.author

    class Meta:
        unique_together = ('date', 'institute', 'author')

class DailyMeeting(models.Model):
    """
    当日券商晨会纪要
    """
    # 发布日期
    date = models.DateField(db_index=True)
    # 发布券商
    institute = models.ForeignKey(Institute)
    # 涉及股票
    stock = models.ForeignKey(Stock)
    # 静态摘要
    static_summary = models.TextField()
    # 纪要链接
    url = models.URLField(max_length=200)

    def __unicode__(self):
        return self.date, self.institute.short_name

    class Meta:
        unique_together = ('date', 'institute', 'stock')

